<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
    //   let name = 'lipan';
    //   let age = 18;

    //   const obj = {
    //     name, //简写的属性在前面
    //     age,
    //     getName(){  //函数省略functionfunction
    //         return `my name is${name}`
    //     }
    //   };
    
    //   console.log(obj);

        //解构赋值(对象)
        const obj = {
            name: 'li',
            age:14,
        }
        let{name,age}=obj
        console.log(name,age)

        //解构数组
        const arr=['猪爸爸','猪妈妈','佩奇','qizoh']
        // let[,,son,dou] =arr
        let[fa,ma,,son] =arr
        console.log(fa,ma,son)


    </script>
  </body>
</html>
